<template>
  <div class="tree">
    <ul>
      <li v-for="(item,index) in treeData" :key="index">
        <el-card :class="item.isCurrent==='1'?'treecard blue':'treecard'">
          <p>申请开立企业名称：{{ item.fbEiName }}</p>
          <p>财票流水号:{{ item.fbFlow }}</p>
          <p>是否融资:{{ item.fbIsFinancing==='1'?'未融资':'已融资' }}</p>
          <p>开立金额:{{ item.fbMoney }}</p>
          <p>开立日期:{{ item.fbStartTime }}</p>
          <p>是否兑付:{{ item.isCash==='1'?'未兑付':'已兑付' }}</p>
          <p>财票类型:
            <template >
              {{ item.fbType|billFilter}}
            </template></p>
          <p>是否拆分:{{ item.isSplit==='1'?'未拆分':'已拆分' }}</p>
        </el-card>
        <TreeItem v-if="item.sonBills&&item.sonBills.length>0" :tree-data="item.sonBills" />
      </li>
    </ul>
  </div>
</template>

<script>
import { billFilter } from '@/utils/codeTransition';

export default {
  name: 'TreeItem',
  filters: { billFilter },
  props: {
    treeData: {
      type: Array,
      default: () => []
    },
    treeFirst: { // 判断是否第一个
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      activeNames: [],
      fbTypeList: [
        {
          value: '1',
          name: '原始财票'
        },
        {
          value: '2',
          name: '转让财票'
        },
        {
          value: '3',
          name: '原始财票转让后'
        }
      ]
    }
  },
  created() {
  },
  methods: {}
}
</script>

<style lang="scss" scoped>
* {
  margin: 0;
  padding: 0;
  text-decoration: none;
}
.tree {
  background: white;
  text-align: center;
}
.tree ul {
  padding-top: 20px;
  position: relative;
  -webkit-transition: all 0.5s;
  -moz-transition: all 0.5s;
  transition: all 0.3s;
  display: inline-flex;
  justify-content: center;
  text-align: center;
}
.tree li {
  flex: 1;
  float: left;
  list-style: none;
  text-align: center;
  position: relative;
  padding: 20px 5px 0 5px;
  width:100%;
}
/*利用::before,::after作分支线*/
.tree li::before,
.tree li::after {
  content: "";
  position: absolute;
  top: 0;
  right: 50%;
  width: 50%;
  height: 20px;
  border-top: 1px solid #ccc;
}
.tree li:after {
  right: auto;
  left: 50%;
  border-left: 1px solid #ccc;
}
.tree li:first-child::before,
.tree li:last-child::after {
  border: 0 none;
}
.tree li:last-child::before {
  border-right: 1px solid #ccc;
  border-radius: 0 10px 0 0;
}
.tree li:first-child::after {
  border-radius: 10px 0 0 0;
}

/*删除仅只有一个分支的分支线*/
.tree li:only-child::before,
.tree li:only-child::after {
  border: none;
}
.tree li:only-child {
  padding-top: 0;
}

/*添加仅只有一个分支的下分支线*/
.tree ul ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  border-left: 1px solid #ccc;
  width: 0;
  height: 20px;
}

.treecard {
 display: inline-block;
  width: 300px;
  // height:200px;
  font-size: 12px;
  background: #e6a23c;
  color:#fff;
  border-radius: 30px;
}
.blue{
  background: #0088ff;
}
</style>
